<?php
	error_reporting(1);
	ini_set('display_errors', 'on');
	Workerman\Protocols\Http::sessionStart();
    $_SESSION["MOBILE_URL"] = "http://".$_SERVER["SERVER_NAME"].":".DEBUG_PORT;
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>我的生活</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <link rel="shortcut icon" href="/favicon.ico">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">

    <link rel="stylesheet" href="./css/sm.css">
    <link rel="stylesheet" href="./css/sm-extend.css">
    <link rel="stylesheet" href="./css/drag.css">
    <style>
      .content {
        color: #999;
      }
      .button.button-fill.button-big {
        line-height: 2.0rem;
        height: 2.0rem;
      }
      .list-block {
        margin: .75rem;
      }
      .content-block {
        margin: .75rem 0;
      }
      .signup a {
        color: #999;
      }
      .log_img{
        width: 100px;
        height: 100px;
        border-radius: 100px;
        clear: both;
        display: block;
        margin: auto;
      }
    </style>
  </head>
   <body>

  <div class="page-group">
      <!-- 你的html代码 -->
      <div class="page page-current" id="page-1581651169664">
          <header class="bar bar-nav">
            <h1 class="title">卜蜂莲花校稿系统</h1>
          </header>
          <div class="content">
            
            <div>
                <img src="./images/bflh.jpg" class="log_img" alt="">
            </div>
            <div class="page-login">
              <div class="list-block inset">
                <ul>
                  <!-- Text inputs -->
                  <li>
                    <div class="item-content">
                      <div class="item-media"><span class="icon iconfont-sm">&#xe7aa;</span></div>
                      <div class="item-inner">
                        <div class="item-input">
                          <input type="text" id="username" placeholder="用户名">
                        </div>
                      </div>
                    </div>
                  </li>
                  <li>
                    <div class="item-content">
                      <div class="item-media"><span class="icon iconfont-sm">&#xe786;</span></div>
                      <div class="item-inner">
                        <div class="item-input">
                          <input type="password" id="password" placeholder="密码">
                        </div>
                      </div>
                    </div>
                  </li>
                </ul>
              </div>
              <div class="content-block">
                <p><a class="button button-big button-fill external" id="login_button" href='#' data-transition='fade'>登录</a></p>
                <p class='text-center signup' style="display: flex;justify-content: space-between;">
                  <a id="register_button" href="#">注册</a>
                  <a href="#" class='pull-right'>忘记密码？</a>
                </p>
                
              </div>
            </div>
            
          </div>
      </div>
  </div>

    <script type="text/javascript" src="./js/zepto.min.js" charset="utf-8"></script>
    <script type="text/javascript" src="./js/sm.js" charset="utf-8"></script>
    <script type="text/javascript" src="./js/sm-extend.js" charset="utf-8"></script>
    <script src="./js/drag.js"></script>
    <script>
        $(function(){
            $(document).on('click','#login_button', function () {
                var data = {action:"get_token",param:{username:$('#username').val(), password:$('#password').val()}};
                $.ajax({
                    type: "POST",
                    url: "<?php echo $_SESSION["MOBILE_URL"];?>",
                    dataType: "json",
                    data:JSON.stringify(data),
                    success: function (result) {
                        if(result["errcode"] != 0){
                            $.showPreloader(result["errmsg"])
                            setTimeout(function () {
                                $.hidePreloader();
                            }, 2000);
                            return;
                        }
                        location.href = "./index.php?user_id="+result["rtval"]["user_id"]+"&access_token="+result["rtval"]["access_token"];
                    },
                    error:function(e){
                        console.log("error11");
                    }
                });
            });


            $(document).on('click','#register_button', function () {

                        location.href = "./register.php";

            });




            
            $.init(); 
        })
        
    </script>
  

<audio controls="controls" style="display: none;"></audio></body>
</html>